<?php
    $this->Html->scriptBlock($scriptSearchBox, array('inline' => false));
?>
<div class="title-body-content"><?php echo $title_for_layout; ?></div>
<div class="searchbox">
    <input type="text" id="search_text" name="sesearch_text" class="searchinput" value="<?php if($q !='all'){ echo $q; }?>" />
    <input type="button" id="search_button" value="Search" class="searchbutton" />
</div>
<div class="wrapper-table clearfix" >
    <table class="tbl-broking" border="1" id="<?php if($q !='all'){ echo 'highlight-plugin'; }?>">
        <tr class="title-tbl" >
            <td class="td-aih-expense-ref"><?php echo $this->Paginator->sort('refid_edit','Reference#'); ?></td>
            <td class="td-aih-expense-date"><?php echo $this->Paginator->sort('Date', 'Date'); ?></td>
            <td class="td-aih-expense-from"><?php echo $this->Paginator->sort('from', 'From'); ?></td>
            <td class="td-aih-expense-to"><?php echo $this->Paginator->sort('to', 'To'); ?></td>
            <td class="td-aih-expense-amount"><?php echo __('Amount'); ?></td>
            <td class="td-menu"></td>
        </tr>
        <?php
        foreach ($aihexpenses AS $aihexpense) {
            $actions = '<li>' . $this->Html->link(__('Edit'), array(
                        'controller' => 'aihexpenses',
                        'action' => 'edit',
                        $aihexpense['Aihexpense']['id'],
                    )) . '</li>';
            $actions .= ' ' . $this->Layout->adminRowActions($aihexpense['Aihexpense']['id']);
            $actions .= ' <li><div class="space3">|</div>' . $this->Html->link(__('Delete'), array(
                        'controller' => 'aihexpenses',
                        'action' => 'delete',
                        $aihexpense['Aihexpense']['id'],
                        'token' => $this->params['_Token']['key'],
                            ), null, __('Are you sure you want to delete this Expense?')) . '</li>';

            echo '
                    <tr class="line-content-tbl" >
                        <td class="td-aih-expense-ref" style="text-align:left; padding-left:5px;">' . $aihexpense['Aihexpense']['refid_edit'] . '</td>
                        <td class="td-aih-expense-date">' . date('m/d/Y', strtotime($aihexpense['Aihexpense']['date'])). '</td>
                        <td class="td-aih-expense-from" style="text-align:left; padding-left:5px;">' . $aihexpense['Aihexpense']['from'] . '</td>
                        <td class="td-aih-expense-to" style="text-align:left; padding-left:5px;">' . $aihexpense['Aihexpense']['to'] . '</td>
                        <td class="td-aih-expense-amount" style="text-align:left; padding-left:5px;">' . $aihexpense['Aihexpense']['amount'] . '</td>
                        <td class="td-action">
                            <ul>
                                ' . $actions . '
                            </ul>
                        </td>
                    </tr>';
        }
        ?>
    </table>
    <div class="wrapper-paging">
        <ul class="ul-paging">
            <?php echo $this->Paginator->numbers(array('tag' => 'li', 'separator' => '')); ?>
        </ul>
        <?php #echo $this->Paginator->counter(array('format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%'))); ?>
    </div>
    <div class="wrapper-button-form">
        <div class="button-form">
            <div class="button-aihre button-blue"><?php echo $this->Html->link(__('NEW'), array('action' => 'add')); ?></div>
        </div>
    </div>
</div>
<?php
$scriptHightlight = "
    $(function(){
        $('#highlight-plugin').removeHighlight().highlight('".$q."');
    });";
$this->Html->scriptBlock($scriptHightlight, array('inline' => false));
?>